@extends('layouts.admin')
@section('content')
    <!--面包屑导航 开始-->
    <div class="crumb_warp">
        <!--<i class="fa fa-bell"></i> 欢迎使用登陆网站后台，建站的首选工具。-->
        <i class="fa fa-home"></i> <a href="{{url('admin/info')}}">首页</a> &raquo; 文章管理
    </div>
    <!--面包屑导航 结束-->

	<!--搜索结果页面 列表 开始-->
        <div class="result_wrap">
            <div class="result_title">
                <h3>文章列表</h3>
            </div>
            <!--快捷导航 开始-->
            <div class="result_content">
                <div class="short_wrap">
                    <form action="{{url('admin/user/index')}}">
                        <select name="num">
                            <option @if($request->input('num')==10) selected @endif value="10">10</option>
                            <option @if($request->input('num')==25) selected @endif value="25">25</option>
                            <option @if($request->input('num')==30) selected @endif value="30">30</option>
                            <option @if($request->input('num')==50) selected @endif value="50">50</option>
                        </select>
                        关键字: <input type="text " name="keyword" value="{{$request->input('keyword')}}" style="padding: 5px 2px;">
                        <input type="submit" value="检索">
                    </form>
                </div>
            </div>
            <!--快捷导航 结束-->
        </div>

        <div class="result_wrap">
            <div class="result_content">
                <table class="list_tab">
                    <tr>
                        <th class="tc">ID</th>
                        <th>用户名</th>
                        <th>邮箱</th>
                        <th>头像</th>
                        <th>个人简介</th>
                        <th>注册时间</th>
                        <th>操作</th>
                    </tr>
                    @foreach($users as $k=>$v)
                    <tr>
                        <td class="tc">{{$v->id}}</td>
                        <td>{{$v->username}}</td>
                        <td>{{$v->email}}</td>
                        <td><img src="{{$v->profile}}" alt="" width="30px;"></td>
                        <td>{{$v->intro}}</td>
                        <td>{{date('Y-m-d H:i:s', $v->date)}}</td>
                        <td>
                            <a href="{{url('admin/user/edit/'.$v->id)}}">修改</a>
                            <a href="{{url('admin/user/delete/'.$v->id)}}">删除</a>
                        </td>
                    </tr>
                    @endforeach

                </table>





                <div class="page_list">
                    {!!$users->appends($request->only(['num','keyword']))->links()!!}
                </div>
                <style>
                    .result_content ul li span {
                        font-size: 15px;
                        padding: 6px 12px;
                    }
                </style>
            </div>
        </div>
    <!--搜索结果页面 列表 结束-->

<script>

    function delArt(art_id)
    {
        //询问框
        layer.confirm('你确定要删除这篇文章吗？', {
            btn: ['确定','取消'] //按钮
        }, function(){
            $.post("{{url('admin/article')}}/"+art_id,{
                "_method":"delete",
                "_token":"{{csrf_token()}}"
            },function(data){
                if(data.status==0){
                    location.href = location.href;
                    layer.msg(data.msg,{icon:6});
                }else{
                    layer.msg(data.msg,{icon:5});
                }
            });

        }, function(){

        });
    }

</script>
@endsection